package com.zhongjy.urtime.data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class UrtimeHoldEventData {
	private static Map<String, UrtimeEvent> urtimeHoldEventData = new HashMap<String, UrtimeEvent>();
	
	public static int size(){
		return urtimeHoldEventData.size();
	}

	public static void addEvent(UrtimeEvent ue) {
		urtimeHoldEventData.put(ue.getEventName(), ue);
	}

	public static void deleteEvent(UrtimeEvent ue) {
		urtimeHoldEventData.remove(ue.getEventName());
	}
	
	public static void deleteEvent(String name) {
		urtimeHoldEventData.remove(name);
	}
	
	public static UrtimeEvent getEvent(String en) {
		return urtimeHoldEventData.get(en);
	}

	public static List<String> getAllEventNames() {
		Set<String> eventNamesKeySet = urtimeHoldEventData.keySet();
		List<String> eventnames = new ArrayList<String>();
		for (String en : eventNamesKeySet) {
			eventnames.add(en);
		}
		return eventnames;
	}

}
